import React from "react";
import { Modal, Form, Input } from "antd";
import { DataType, IUserListItem } from "../../interface/IUserList";

export default function AddAndEdit(props: {
  isShow: boolean;
  setIsShow: (show: boolean) => void;
  editData: DataType | null;
}) {
  const [form] = Form.useForm();
  const handleOk = () => {};

//   if (form) {
//     if (props.editData) {
//       form.setFieldsValue(props.editData);
//     } else {
//        form.resetFields();
//     }
//   }

  return (
    <Modal
      title={!props.editData ? "新增" : "编辑"}
      closable={{ "aria-label": "Custom Close Button" }}
      open={props.isShow}
      onOk={handleOk}
      onCancel={() => props.setIsShow(false)}
    >
      <Form
        name="form"
        form={form}
        labelCol={{ span: 8 }}
        wrapperCol={{ span: 16 }}
        style={{ maxWidth: 600 }}
        initialValues={{ usename: "aaaa" }}
        autoComplete="off"
      >
        <Form.Item<IUserListItem> label="用户名" name="username">
          <Input />
        </Form.Item>

        <Form.Item<IUserListItem> label="姓名" name="realname">
          <Input />
        </Form.Item>
        <Form.Item<IUserListItem> label="性别" name="age">
          <Input />
        </Form.Item>
         <Form.Item<IUserListItem> label="性别" name="sex">
          <Input />
        </Form.Item>
         <Form.Item<IUserListItem> label="性别" name="avatar">
          <Input />
        </Form.Item>
         <Form.Item<IUserListItem> label="性别" name="birthday">
          <Input />
        </Form.Item>
         <Form.Item<IUserListItem> label="性别" name="city">
          <Input />
        </Form.Item>
        
      </Form>
    </Modal>
  );
}
